import sys
import os

sys.path.append("../dist/lib/")

import filesystem

# remove test_lfs before running this

os.makedirs("./test_lfs/")
os.makedirs("./test_lfs/subdir/")

lfs = filesystem.LeonardoFileSystem("./test_lfs/")

b1 = lfs.get("foo")

assert b1.exists() == False

b1.set_content("test content", "txt")

assert b1.exists() == True
assert b1.get_content() == "test content"
assert b1.get_content_type() == "txt"

b1.get_lastmod()

assert lfs.get_children("/") == (['subdir'], ['foo'])

b1.set_property("prop1", "value1")

assert b1.get_property("prop1") == "value1"

b1.enclosure("embedded", 1).set_content("embedded content", "txt")

assert b1.enclosure("embedded", 1).get_content() == "embedded content"
